<?php
/**
 * Core_Model_Loadtemplate
 * check template to load
 * 
 * @author astolarski
 *
 */
class Core_Model_Loadtemplate implements Core_Model_Mainable {
	
	/**
	 * check template to load
	 * 
	 * @see Core_Model_Mainable::main()
	 */
	public function main(array $variables = null){
		try {
			if(file_exists($variables['template'])){
				return true;
			}
			else {
				$variables['filename'] = $variables['template'];
				$bad_value = new Core_Data_Filedoesnotexists();
				$message = $bad_value->main($variables);
				throw new Exception($message);
			}
		}
		catch (Exception $exception){
			echo $exception->getMessage();
		}
	}
	
}